﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using DAL;
using System.Web.Compilation;
using System.Web.UI;

/// <summary>
/// Summary description for RPTRouterHandler
/// </summary>
public class RPTRouterHandler : IRouteHandler
{
    public RPTRouterHandler()
    {
        //
        // TODO: Add constructor logic here
        //
    }
    public IHttpHandler GetHttpHandler(RequestContext requestContext)
    {
        try
        {
            string data = requestContext.RouteData.Values["data"] as string;
            switch (data)
            {
                case "daily": return BuildManager.CreateInstanceFromVirtualPath("~/Report/DailyReport.aspx", typeof(Page)) as Page;
                case "pend": return BuildManager.CreateInstanceFromVirtualPath("~/Report/PendingOrders.aspx", typeof(Page)) as Page;
                case "viewdel": return BuildManager.CreateInstanceFromVirtualPath("~/Report/YeuCauSoanHangReport.aspx", typeof(Page)) as Page;
                case "as": return BuildManager.CreateInstanceFromVirtualPath("~/Report/ActualSales.aspx", typeof(Page)) as Page;
                case "ashcm": return BuildManager.CreateInstanceFromVirtualPath("~/Report/ActualSalesHCM_FHS.aspx", typeof(Page)) as Page;
                case "tkho": return BuildManager.CreateInstanceFromVirtualPath("~/Report/MatHang_TonKho.aspx", typeof(Page)) as Page;
                case "soth": return BuildManager.CreateInstanceFromVirtualPath("~/Report/DanhSach_SO_Thieu.aspx", typeof(Page)) as Page;
                case "dtmh": return BuildManager.CreateInstanceFromVirtualPath("~/Report/DoanhThuChiTietMatHang.aspx", typeof(Page)) as Page;
                case "dtmou": return BuildManager.CreateInstanceFromVirtualPath("~/Report/DoanhThuChiTietMatHang_Thang.aspx", typeof(Page)) as Page;
                case "thxnt": return BuildManager.CreateInstanceFromVirtualPath("~/Report/TongHop_XuatNhap_Ton.aspx", typeof(Page)) as Page;
                case "plm": return BuildManager.CreateInstanceFromVirtualPath("~/Report/DoanhThu_Theo_KhuVuc.aspx", typeof(Page)) as Page;
                case "thcp": return BuildManager.CreateInstanceFromVirtualPath("~/Report/LandedCost_GetAll.aspx", typeof(Page)) as Page;
                
                   
                default:
                    {
                        return BuildManager.CreateInstanceFromVirtualPath("~/Report/DailyReport.aspx", typeof(Page)) as Page;

                    }
            }
        }
        catch
        {
            return null;
        }

    }
}